package cn.edu.scau.cmi.wujiaxian.exercise9;

import java.util.Scanner;

public class Example9_20 {
	
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		String cost = " TV cost 876 dollar. Computer cost 2398 dollar. telephone cost 1278 dollar";
		Scanner scanner = new Scanner(cost);
		double sum = 0;
		while (scanner.hasNext()) {
			try {
				double price = scanner.nextDouble();
				sum += price;
				System.out.println(price);
			} catch (Exception e) {
				scanner.next();
			}
		}
		System.out.println(sum);
	}
	
}
